import { createApp } from 'vue'
import '@/assets/iconfont/iconfont.scss'
import '@/assets/iconfont/font/iconfont.css'
import 'element-plus/dist/index.css'
import * as Icons from '@element-plus/icons-vue'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import Particles from '@tsparticles/vue3'
import { loadSlim } from '@tsparticles/slim'
import App from './App.vue'
import directives from '@/directives/index'
import router from '@/routers'
import pinia from '@/stores'

const app = createApp(App)

app.use(Particles, {
  init: async (engine) => {
    await loadSlim(engine)
  },
})
// 注册 element 图标
Object.keys(Icons).forEach((key) => {
  app.component(key, Icons[key as keyof typeof Icons])
})

app
  .use(ElementPlus, { locale: zhCn })
  .use(directives)
  .use(router)
  .use(pinia)
  .mount('#app')
